import http from "../request";
const apibase = "/api/DataField";

//获取字段名称
var getDataFields = function (data) {
  return new Promise((resolve, reject) => {
    http
      .post(apibase + `/GetDataFields`, data)
      .then((res) => {
        resolve(res);
      })
      .catch((error) => {
        reject(error);
      });
  });
};

//新增字段
var addDataField = function (data) {
  return new Promise((resolve, reject) => {
    http
      .post(apibase + `/AddDataField`, data)
      .then((res) => {
        resolve(res);
      })
      .catch((error) => {
        reject(error);
      });
  });
};

//修改字段
var updateDataField = function (data) {
  return new Promise((resolve, reject) => {
    http
      .post(apibase + `/UpdateDataField`, data)
      .then((res) => {
        resolve(res);
      })
      .catch((error) => {
        reject(error);
      });
  });
};

//删除字段
var deleteDataField = function (data) {
  return new Promise((resolve, reject) => {
    http
      .post(apibase + `/DeleteDataField`, data)
      .then((res) => {
        resolve(res);
      })
      .catch((error) => {
        reject(error);
      });
  });
};

export { getDataFields,addDataField,deleteDataField,updateDataField};
